First working prototype code