Cleaned the code and converted tabs to spaces via http://gist.github.com/smilinmonki666/4995263#file-tabs-to-spaces-sh closes #1