adding unit test and the missing funcitonality implementation