refractors RCON code to be more idiomatic