Seperate JS from html, indent somewhat, cleanup, reorganize