Better code formatting

Formatted code on jsbeautifier.org