Fixed some stuff and added some comments