main flex