removed comments and changed loops