protect header file and reformat/cleanup code