added header support, reformatted and restyled