Fixed JSLint errors and cleaned up code presentation