Added a few more comments. Added return values for some functions.