nearly got it working