Cleaning before space top and bottom functionality