angular 1.2 rewrite and cleaning