Refactor redundant code using keyword this