major refactor, divided into managers, tested, should be ok