Some code simplification