minor changes, adding function