working prototype code