Small revision to the unit changing logic and new tests written