adding headers and fixing all code