added logic from angular-seed