Fixing redundant code