got rid of most of the .h files

global functions rewritten
this should have been in the last commit