Add method to refactor code