refactored the facade pattern code