Fixed some bugs with conditionals, added some comments