refactor old code