Various updates and reorganization. Cleaned up some code.