Adding specs for javascripts, reorganizing angular code