modulize exiting functions