Cleaned up main3