changed functions structure