Minor refactoring, removed useless function