api code simplification