Added some javascript and started working on the logic.