Added thur's code