preparing a new hack session: code and unit tests