separate out validation passes in toploop

Mind the sneaky monad bit. It just cuts down on repeated matching.