working version with krantz exercise