Moved more code to classes