refactor to angular way