Minor structural changes to /api, JS fixes for single purchase