Made some code simplifications