Cleaning up and adding first part of code