Fix some bugs after testing. Works now with minimal feature set.