Andrei's experimental Torch code. Use with care!