Fixed some types and added some more comments