Fixing a bug, adding unit tests and preference option for SmartPlace.