API cleaning
simplify the code