Fixed bugs and removed debugging