Check in refactored prototype code & main stub.