Some code simplifications