Cleaning up JS Code