cleanup directory and setup sessions