Updated code from testing