Added more logic to mode method to solve tie bug
Merge branch 'tie_bug'