finished class exercises, refactored a bit