cleaned up code and added header info for mesh stats