clear up codes and add comments