Fixed bugs to the point the code is compilable