 	
 Blender::getTile = (z,x,y, cb) ->
 	#console.log "getting"
-	opts={layer : @base}
+	opts={}
 	opts.zoom = z
 	opts.y = y
 	opts.x = x
 	opts.format = "png"
-	@routes.getTile opts, (err, base)=>
-		#console.log "getting base"
-		opts.layer = @overlay
-		@routes.getTile opts, (err, overlay)=>
-			composit base, overlay, cb
+	mapFunc = (l, clb)=>
+		opts.layer = l
+		@routes.getTile opts, clb
+	filterFunc = (a,c)->
+		c !!a
+	async.map @layers, mapFunc, (err, tilesRaw)->
+		async.filter tilesRaw, filterFunc, (tiles)->
+			composit tiles, cb
 		

pngparse = require 'pngparse'
async = require 'async'
im = require 'imagemagick'    
    
parsePng = (buff, cb)->    
	pngparse.parse buff, (err, data) ->
		if err

	jsonp:()->undefined
	
Blender = (opt, routes)->
	@layers = opt.layers
	@routes = routes
	@

