refactored debug and mocking for angular