The code here smell pretty bad. Please refactor your code once you see duplication....