Fixed bugs, it mostly works now.