Major improvements to implementation. Near parity of previous version.