Adding some "with open" and cleaning