Fixed most errors. Ready for implementation!