Abstract prefix suffix and minimize vars