Partially debugged and fixed some stuff.