cleaning up code and removing unneeded bubbles