refactored takeaway class and tests