Added test cases for deeply nested keys to the unit tests and refactored code for more consistent style