Simplify orginal code