Refacto and angular 1.3.5 compatibility