[fix] Slight refactoring and optimization in main.js.
Merge remote-tracking branch 'origin/master'

Conflicts:
	public/js/main.js
Merge remote-tracking branch 'origin/master'

Conflicts:
	public/js/main.js
Merge remote-tracking branch 'origin/master'