Added unit tests for key (partly)