fix formatting issues
handle IO exceptions and change naming conventions