Moved function to try and pin-point error.