added peek method and corresponding test