Comment and cleanup javascript code