fixed a bug which made life difficult for stone3
tidy up, removal of some redundant code