improvements from @ali-graham's feedback, thanks