Huge changeset since I went crazy and changed many things until it worked. Now it works...