Added base functionality for classes generation and consolidated repeated code into their own functions