Simplify some bits of the code.