Moving block logic into a module