code tidy, props @GaryJones