Cleaning up, adding functions