Fixing whitespace and few improvements to @madjake45's code.