Slightly code refactoring