clean up code and add header