refactor code and add angular