general cleanup + refactoring
added new actions, refactored serialization, added tests