Removing inline JS in the markup and some cleanups