Started cleaning up code