Cleaning up code  and styling for issue #144 fix