Changed all i++ to ++i