Add some logic and unit test