clarifying functions and deleting unnecessary code