finishes the main functions with testing