Refactore unused code