Refactored and added more scenarios.