updated to work in modules