Refactor of how the code is written to align with Angular conventions seen elsewhere in docs
added tests