refactored pr #5