reworked keymanager a bit more