Working version, finally.