New implementation, by Khrall