add unit test, fix whitespace, add grunt config, fix some TS issues