Removed unnecessary main variables and improved printing format