tidied up code (no code changes)