Improve API use and switch require use