complete all the small functions,only main left