trying to work out errors