modify some previous written functions, testing is essential