started to refactor old code