add header file, and some cleanup