tidied code