cleanup, tests and epoch learning