Some more changes to the manager, added some tests.