refactored code to stop using cup (no need to include it anymore)