Initial versions of compute functions done.

Still has bugs.