refactoring using angular structure