adapted from angular-seed