Cleared up javascript and add view