tidied js code