refactored main to use mainCache service