Cleaned up GET/POST with reusable functions