working on space filling algorithm