Several fixes. Actually works.