tidied up a bit with JSHint