Tidied code and added header selector