Further code style changes and added test case