Initial set of functions implemented: copy, fill, flatten, max, min, sum.

Cleaned up low level constructor and removed dependency on system max/min.