removing newlines at end
changing output method