make functions for some tasks.
clean up.