updated to version which works