Refactoring, removed unused function