Refactored to more classical style and dropped mocking