Fixed some errors hopefully and erased more unnecessary code