 
 class Crossover extends Piece
 	setSection: (section) ->
-		@connections.B = new Connection(
+		@connections.B = new ConnectedTransform(
 			Math.sin(@angle)*section.track.gridSize,
 			@flip*(1-Math.cos(@angle))*section.track.gridSize,
 			@flip*@angle*180/Math.PI)
-		@connections.C = new Connection(
+		@connections.C = new ConnectedTransform(
 			2*section.track.gridSize*Math.sin(@angle/2),
 			@flip*2*section.track.gridSize*(1-Math.cos(@angle/2)),
 			0)
-		@connections.D = new Connection(
+		@connections.D = new ConnectedTransform(
 			section.track.gridSize*(2*Math.sin(@angle/2)-Math.sin(@angle)),
 			@flip*section.track.gridSize*(1-(2*Math.cos(@angle/2))+Math.cos(@angle)),
 			@flip*((@angle*180/Math.PI)-180))


class Join extends Piece
	setSection: (section) ->
		@connections.B = new Connection(@size*section.track.gridSize, 0, 0)
		@connections.C = new Connection(
			((2/3)-Math.sin(@angle))*section.track.gridSize,
			@flip*(1-Math.cos(@angle))*section.track.gridSize,
			@flip*@angle*3*180/Math.PI)

		@_listeners = {}
		@_gapTransform = new Transform(@trackGap, 0, 0)

	# attach listener to "add", "remove" or "change" types of event
	on: (types, listener) ->
		types.split(" ").forEach (type) =>
			if !@_listeners[type]? then @_listeners[type] = []
