set up enterance and finish functions