splitting space into boxes