cleaned up library code to take advantage of some compilers