Code complete.
Needs cleaning up.