Fixes

now functional if a little computationally complex.