Finished functionality
removed inefficient code