completed.

just need to clean up. may be some more bugs but works with values
tested so far