Moved functions around.

Also, added new function beam->module which allowed me to rewrite
beams->modules.