Fixed attempted to call nil errors due to moving explode to functions