Changed code for to run with Alex's code