cleanup code
tidied