final project

changed functions to eliminate redundant code