REST API

Moving code around, possible breaks :)