changing classes to case classes