title code refactor