Clean up commented out code
Make js code more DRY