Refactored ordering process and added caching