added comments for methods + changed input and output streams + changed test-cases