Moved the API in a separate file, better logging
Added API docs