Included @fabsh 's precision improvement

This adds the precision improvement to the functional version.