Added unit and functional tests