added code for john.m