worked on mainviews for js getting rid of spahgetti code