Added ngStorage and considerable refactoring