refactor hole code