Simplify further by using global variables