Develop

Updated code base. Fixed misc bugs and tests.