Added comments, cleared up compiler warnings