refactor the current code base. TODO: need to print the functions and check the reachability