Moved Apex from console snippet into class