added possibility to run as module