updating joel's code