moved core API to a separate file