Fixed Dave's merged code