Cleanup

There are some changes/improvements I would like to make; however, I was met with horribly inconsistent whitespace and the like.

This PR is general code cleanup and bugfixes of the current implementation. Since I wasn't able to figure out a current consistent codestyle (viewing with 4space tabs), the first commit is whitespace changes (and putting `if`s in `{ curly braces }`)

I used the following `jscs` ruleset for codestyle changes
```json
{
	"requireCurlyBraces": [
		"if",
		"else",
		"for",
		"while",
		"do",
		"try",
		"catch",
		"case",
		"default"
	],
	"requireSpaceAfterKeywords": [
		"if",
		"else",
		"for",
		"while",
		"do",
		"switch",
		"return",
		"try",
		"catch"
	],
	"requireParenthesesAroundIIFE": true,
	"requireSpacesInFunctionExpression": {
		"beforeOpeningRoundBrace": true,
		"beforeOpeningCurlyBrace": true
	},
	"requireBlocksOnNewline": true,
	"disallowSpacesInsideArrayBrackets": true,
	"disallowSpacesInsideParentheses": true,
	"requireCommaBeforeLineBreak": true,
	"requireLeftStickedOperators": [","],
	"validateQuoteMarks": "'",
	"validateIndentation": "\t",
	"disallowMixedSpacesAndTabs": true,
	"disallowTrailingWhitespace": true,
	"disallowKeywordsOnNewLine": ["else"],
	"requireLineFeedAtFileEnd": true,
	"validateJSDoc": {
		"checkParamNames": true,
		"checkRedundantParams": true,
		"requireParamTypes": true
	}
}
```