Refactor code & Replace all var by val & Clean code