Move to api file and update docs