tidy up to keep the code DRY