Code complete.

comments and testing still needed.