adds docs
unify for-loops
throws proper error on failed reading input