added min-angle function