First Functional Version

This is functional proof although its not fully optimized for run speed.