updating functions, cleaning up code and files.