pull api functions out into their own files and add copyright/license