Bit more work... Completely untested though...