small improvements to require_a, rewrote several require_a statements in functions