refoactored API and moved it to slim