More code refactoring as before