Updated the uva591 impl