Added/changed comments, added/renamed a few functions