extract classes to separate files
tests almost passing