Code cleanup

Did some minor cleanup. Removed inline javascript from html and added  object literal and event based interaction which will be easier to build functionality on.