Fix header/footer + code clean up