tweaked comments, fixed array indexing bug