large overhaul to API implementation (work in progress)