Add unit tests for new feature and code style

This adds some unit tests to your feature and fixes some minot code style issues.