Several changes and tests