reverted to a version that uses minifiable angular
refactored to use service