Cleaned some of the code and renamed some of the methods