Changed the locking code to remove the module scope
Make cubeMaker a global to work around weird issues with passing it as
parameter to tasks