Some more fixes. The prototype is now fully working.