Fixing to run as server module. TODO: fix variable injection