Refactor code and make sure Paperclip specs pass with newest version of Paperclip