Cleaned up main slightly.