separate logging and clean up api methods