ionic refactor