Made module global and added some tests