Moved a lot to classes