Move init and exit in right place