More bug fixing and attempting to get tests to pass.