added some more comments and fixed some newlines