   defp handle_sync_cmd(kind, id, payload, state) do
     mod = Module.concat(["Farmbot", "Repo", kind])
     if Code.ensure_loaded?(mod) do
-      %{"body" => body, "args" => %{"label" => uuid}} = Poison.decode!(payload, as: %{"body" => struct(mod)})
+      %{
+        "body" => body,
+        "args" => %{"label" => uuid}
+      } = Poison.decode!(payload, as: %{"body" => struct(mod)})
+
       Farmbot.Repo.register_sync_cmd(String.to_integer(id), kind, body)
 
-      if Farmbot.System.ConfigStorage.get_config_value(:bool, "settings", "auto_sync") do
+      if get_config_value(:bool, "settings", "auto_sync") do
         Farmbot.Repo.flip()
       end
 
-      Farmbot.CeleryScript.AST.Node.RpcOk.execute(%{label: uuid}, [], struct(Macro.Env))
+      AST.Node.RpcOk.execute(%{label: uuid}, [], struct(Macro.Env))
     else
-      Logger.warn 2, "Unknown syncable: #{mod}: #{inspect Poison.decode!(payload)}"
+      msg = "Unknown syncable: #{mod}: #{inspect Poison.decode!(payload)}"
+      Logger.warn 2, msg
     end
     {:noreply, [], state}
   end

  use GenStage
  use AMQP
  use Farmbot.Logger
  alias Farmbot.System.ConfigStorage
  alias Farmbot.CeleryScript
  alias CeleryScript.AST
  import Farmbot.BotState.Utils

  @exchange "amq.topic"


          minor_version: log.version.minor,
          patch_version: log.version.patch,
        }
        log_without_pos = %{
          created_at: log.time,
          meta: meta,
          channels: log.meta[:channels] || [],
          message: log.message
        }
        log = add_position_to_log(log_without_pos, location_data)
        push_bot_log(state.chan, state.bot, log)
      end
