Layers and snap to grid

fixes #3 and #4