more tests, small formatting tweaks, refactored parsing into 2 methods to make it more readable.
fixed merge issue