Remove some duplication
Small simplifications and cleanups