Working enhanced prototype code