Removing code duplication

By using the "Use Surround Method" refactoring pattern.