Refactored based on angular-seed