Commented main and simplified some calculations.