refactored to use angular model