reading input(corrected), removed debugging info