Merge mode2 into original file
Fixed println
Implemented mode2 for iOS