Cleaned up javascript, syntax-wise