Fixed bugs. Still not really working.