Improve IO part of standard library

Do not use first/last properties, they will be removed. Use first()/last() methods.