Simplify code by removing not needed variable