Fixed up some formatting and removed some warning-causing lines about comparing value types to null and unreachable code.
Fixed up some formatting and removed some warning-causing lines about comparing value types to null and unreachable code.

--- a/CoreStrut.cs
+++ b/CoreStrut.cs
@@ -9,218 +9,225 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+
 //using System.Threading.Tasks;
 using UnityEngine;
 
 namespace QuantumStrut
 {
-    class CoreStrut
-    {
-        public bool isDestroyed = false;
-
-        Material _material = null;
-        public Material Material
-        {
-            set
-            {
-                _material = value;
-                if (Material != null)
-                    lr.material = Material;
-            }
-            get
-            {
-                return _material;
-            }
-        }
-
-        Color _startColor = Color.white;
-        public Color StartColor
-        {
-            set
-            {
-                _startColor = value;
-                if (StartColor != null && EndColor != null)
-                    lr.SetColors(StartColor, EndColor);
-            }
-            get
-            {
-                return _startColor;
-            }
-        }
-
-        Color _endColor = Color.white;
-        public Color EndColor
-        {
-            set
-            {
-                _endColor = value;
-                if (StartColor != null && EndColor != null)
-                    lr.SetColors(StartColor, EndColor);
-            }
-            get
-            {
-                return _endColor;
-            }
-        }
-
-        float _startSize = 0;
-        public float StartSize
-        {
-            set
-            {
-                _startSize = value;
-                lr.SetWidth(StartSize, EndSize);
-            }
-            get
-            {
-                return _startSize;
-            }
-        }
-
-        float _endSize = 0;
-        public float EndSize
-        {
-            set
-            {
-                _endSize = value;
-                lr.SetWidth(StartSize, EndSize);
-            }
-            get
-            {
-                return _endSize;
-            }
-        }
-
-        ConfigurableJoint joint;
-
-        public bool Active = true;
-        public bool Selected = false;
-        public Part parent = null;
-        public Vector3 parentOffset = Vector3.zero;
-
-        public Part target = null;
-        public Vector3 targetOffset = Vector3.zero;
-
-        GameObject LineObj;
-        LineRenderer lr = null;
-
-        public void print(object body, params object[] args)
-        {
-            string final = body.ToString();
-            for (int I = 0; I < args.Length; I++)
-            {
-                final = final.Replace("{" + I + "}", args[I].ToString());
-            }
-            MonoBehaviour.print("[AutoStrut] " + final);
-        }
-
-        void DrawLine(Vector3 origin, Vector3 end)
-        {
-            if (Util.isValid(lr))
-            {
-                lr.SetPosition(0, origin);
-                lr.SetPosition(1, end);
-            }
-        }
-
-        void createJoint()
-        {
-            if (!Util.isValid(joint))
-            {
-                joint = parent.gameObject.AddComponent<ConfigurableJoint>();
-                joint.connectedBody = target.rigidbody;
-
-                joint.anchor = new Vector3(0, 0, Vector3.Distance(parent.transform.TransformPoint(parentOffset), target.transform.TransformPoint(targetOffset)) / 2);
-                joint.axis = new Vector3(0, 0, 1);
-                joint.xMotion = ConfigurableJointMotion.Locked;
-                joint.yMotion = ConfigurableJointMotion.Locked;
-                joint.zMotion = ConfigurableJointMotion.Locked;
-                joint.angularXMotion = ConfigurableJointMotion.Locked;
-                joint.angularYMotion = ConfigurableJointMotion.Locked;
-                joint.angularZMotion = ConfigurableJointMotion.Locked;
-            }
-        }
-
-        void deleteJoint()
-        {
-            if (Util.isValid(joint))
-                GameObject.DestroyImmediate(joint);
-        }
-
-        public CoreStrut(Part parent, Vector3 parentOffset, Part target, Vector3 targetOffset)
-        {
-            this.parent = parent;
-            this.parentOffset = parentOffset;
-            this.target = target;
-            this.targetOffset = targetOffset;
-
-            createJoint();
-
-            LineObj = new GameObject();
-            LineObj.name = "quantumstrut";
-
-            lr = LineObj.AddComponent<LineRenderer>();
-            lr.useWorldSpace = true;
-
-            Material = QuantumStrut.LaserMaterial;
-            StartColor = Color.white;
-            EndColor = Color.white;
-            StartSize = 0.03f;
-            EndSize = 0.0075f;
-
-            lr.SetVertexCount(2);
-            lr.SetPosition(0, Vector3.zero);
-            lr.SetPosition(1, Vector3.zero);
-        }
-
-        public void Update()
-        {
-            if (Util.isValid(parent) && Util.isValid(target) && Util.isValid(parent.vessel) && parent.vessel.parts.Contains(target))
-            {
-                if (Active)
-                {
-                    createJoint();
-                    Vector3 start = parent.transform.TransformPoint(parentOffset);
-                    Vector3 end = target.transform.TransformPoint(targetOffset);
-                    if (Selected)
-                        lr.SetColors(Color.blue, Color.blue);
-                    else
-                        lr.SetColors(StartColor, EndColor);
-                    DrawLine(start, end);
-                }
-                else
-                {
-                    deleteJoint();
-                    DrawLine(Vector3.zero, Vector3.zero);
-                }
-            }
-            else
-            {
-                DrawLine(Vector3.zero, Vector3.zero);
-                Destroy();
-            }
-        }
-
-        public void Destroy()
-        {
-            DrawLine(Vector3.zero, Vector3.zero);
-            if (Util.isValid(joint))
-                GameObject.DestroyImmediate(joint);
-
-            if (Util.isValid(lr))
-                GameObject.DestroyImmediate(lr);
-
-            if (Util.isValid(LineObj))
-                GameObject.DestroyImmediate(LineObj);
-
-            joint = null;
-            LineObj = null;
-            lr = null;
-
-            parent = null;
-            target = null;
-            targetOffset = Vector3.zero;
-            isDestroyed = true;
-        }
-    }
+	class CoreStrut
+	{
+		public bool isDestroyed = false;
+		Material _material = null;
+
+		public Material Material
+		{
+			set
+			{
+				_material = value;
+				if (Material != null)
+					lr.material = Material;
+			}
+			get
+			{
+				return _material;
+			}
+		}
+
+		Color _startColor = Color.white;
+
+		public Color StartColor
+		{
+			set
+			{
+				_startColor = value;
+				lr.SetColors(StartColor, EndColor);
+			}
+			get
+			{
+				return _startColor;
+			}
+		}
+
+		Color _endColor = Color.white;
+
+		public Color EndColor
+		{
+			set
+			{
+				_endColor = value;
+				lr.SetColors(StartColor, EndColor);
+			}
+			get
+			{
+				return _endColor;
+			}
+		}
+
+		float _startSize = 0;
+
+		public float StartSize
+		{
+			set
+			{
+				_startSize = value;
+				lr.SetWidth(StartSize, EndSize);
+			}
+			get
+			{
+				return _startSize;
+			}
+		}
+
+		float _endSize = 0;
+
+		public float EndSize
+		{
+			set
+			{
+				_endSize = value;
+				lr.SetWidth(StartSize, EndSize);
+			}
+			get
+			{
+				return _endSize;
+			}
+		}
+
+		ConfigurableJoint joint;
+		public bool Active = true;
+		public bool Selected = false;
+		public Part parent = null;
+		public Vector3 parentOffset = Vector3.zero;
+		public Part target = null;
+		public Vector3 targetOffset = Vector3.zero;
+		GameObject LineObj;
+		LineRenderer lr = null;
+
+		public void print(object body, params object[] args)
+		{
+			string final = body.ToString();
+			for (int I = 0; I < args.Length; I++)
+			{
+				final = final.Replace("{" + I + "}", args[I].ToString());
+			}
+			MonoBehaviour.print("[AutoStrut] " + final);
+		}
+
+		void DrawLine(Vector3 origin, Vector3 end)
+		{
+			if (Util.isValid(lr))
+			{
+				lr.SetPosition(0, origin);
+				lr.SetPosition(1, end);
+			}
+		}
+
+		void createJoint()
+		{
+			if (!Util.isValid(joint))
+			{
+				joint = parent.gameObject.AddComponent<ConfigurableJoint>();
+				joint.connectedBody = target.rigidbody;
+
+				joint.anchor = new Vector3(
+					0,
+					0,
+					Vector3.Distance(
+						parent.transform.TransformPoint(parentOffset),
+						target.transform.TransformPoint(targetOffset)
+					) / 2
+				);
+				joint.axis = new Vector3(0, 0, 1);
+				joint.xMotion = ConfigurableJointMotion.Locked;
+				joint.yMotion = ConfigurableJointMotion.Locked;
+				joint.zMotion = ConfigurableJointMotion.Locked;
+				joint.angularXMotion = ConfigurableJointMotion.Locked;
+				joint.angularYMotion = ConfigurableJointMotion.Locked;
+				joint.angularZMotion = ConfigurableJointMotion.Locked;
+			}
+		}
+
+		void deleteJoint()
+		{
+			if (Util.isValid(joint))
+				GameObject.DestroyImmediate(joint);
+		}
+
+		public CoreStrut(Part parent, Vector3 parentOffset, Part target, Vector3 targetOffset)
+		{
+			this.parent = parent;
+			this.parentOffset = parentOffset;
+			this.target = target;
+			this.targetOffset = targetOffset;
+
+			createJoint();
+
+			LineObj = new GameObject();
+			LineObj.name = "quantumstrut";
+
+			lr = LineObj.AddComponent<LineRenderer>();
+			lr.useWorldSpace = true;
+
+			Material = QuantumStrut.LaserMaterial;
+			StartColor = Color.white;
+			EndColor = Color.white;
+			StartSize = 0.03f;
+			EndSize = 0.0075f;
+
+			lr.SetVertexCount(2);
+			lr.SetPosition(0, Vector3.zero);
+			lr.SetPosition(1, Vector3.zero);
+		}
+
+		public void Update()
+		{
+			if (Util.isValid(parent) && Util.isValid(target) && Util.isValid(parent.vessel) && parent.vessel.parts.Contains(target))
+			{
+				if (Active)
+				{
+					createJoint();
+					Vector3 start = parent.transform.TransformPoint(parentOffset);
+					Vector3 end = target.transform.TransformPoint(targetOffset);
+					if (Selected)
+						lr.SetColors(Color.blue, Color.blue);
+					else
+						lr.SetColors(StartColor, EndColor);
+					DrawLine(start, end);
+				}
+				else
+				{
+					deleteJoint();
+					DrawLine(Vector3.zero, Vector3.zero);
+				}
+			}
+			else
+			{
+				DrawLine(Vector3.zero, Vector3.zero);
+				Destroy();
+			}
+		}
+
+		public void Destroy()
+		{
+			DrawLine(Vector3.zero, Vector3.zero);
+			if (Util.isValid(joint))
+				GameObject.DestroyImmediate(joint);
+
+			if (Util.isValid(lr))
+				GameObject.DestroyImmediate(lr);
+
+			if (Util.isValid(LineObj))
+				GameObject.DestroyImmediate(LineObj);
+
+			joint = null;
+			LineObj = null;
+			lr = null;
+
+			parent = null;
+			target = null;
+			targetOffset = Vector3.zero;
+			isDestroyed = true;
+		}
+	}
 }

--- a/QuantumStrut.cs
+++ b/QuantumStrut.cs
@@ -9,331 +9,330 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+
 //using System.Threading.Tasks;
 using UnityEngine;
 
 namespace QuantumStrut
 {
-    public class QuantumStrut : PartModule
-    {
-        public static Material LaserMaterial;
-
-        Strut strut = null;
-        GameObject lineObj;
-        LineRenderer lr;
-        bool Editor = false;
-        int I = 0;
-
-        #region Fields
-        [KSPField(isPersistant = true)]
-        public bool IsEnabled = true;
-
-        [KSPField(isPersistant = false)]
-        public float PowerConsumption = 0;
-
-
-        [KSPField(isPersistant = false)]
-        public string TransformName = "";
-
-        [KSPField(isPersistant = false)]
-        public Vector3 Start = new Vector3(0,0,0);
-
-        [KSPField(isPersistant = false)]
-        public Vector3 Dir = new Vector3(0, 1, 0);
-
-
-        [KSPField(isPersistant = false)]
-        public string Material = "Particles/Additive";
-
-        [KSPField(isPersistant = false)]
-        public Vector3 StartColor = Vector3.zero;
-
-        [KSPField(isPersistant = false)]
-        public Vector3 EndColor = Vector3.zero;
-
-
-        [KSPField(isPersistant = false)]
-        public float StartSize = 0.03f;
-
-        [KSPField(isPersistant = false)]
-        public float EndSize = 0.0075f;
-        #endregion
-
-        #region Actions
-        [KSPAction("Toggle")]
-        public void ToggleStrut(KSPActionParam param)
-        {
-            IsEnabled = !IsEnabled;
-            CheckHit();
-        }
-
-        [KSPAction("Activate")]
-        public void ActivateStrut(KSPActionParam param)
-        {
-            IsEnabled = true;
-            CheckHit();
-        }
-
-        [KSPAction("Deactivate")]
-        public void DeactivateStrut(KSPActionParam param)
-        {
-            IsEnabled = false;
-            CheckHit();
-        }
-        #endregion
-
-        #region Events
-        [KSPEvent(guiActive = true, guiName = "Activate", active = true)]
-        public void ActivateStrut()
-        {
-            IsEnabled = true;
-            CheckHit();
-        }
-
-        [KSPEvent(guiActive = true, guiName = "Deactivate", active = false)]
-        public void DeactivateStrut()
-        {
-            IsEnabled = false;
-            CheckHit();
-        }
-        #endregion
-
-        public Material material = null;
-        public Color startColor = Color.white;
-        public Color endColor = Color.white;
-
-        public Color Vector3toColor(Vector3 vec)
-        {
-            return new Color(vec.x/255, vec.y/255, vec.z/255);
-        }
-
-        Transform getTransform()
-        {
-            if (TransformName == "")
-                return part.transform;
-            else
-                return part.FindModelTransform(TransformName);
-        }
-
-        public void print(object body, params object[] args)
-        {
-            string final = body.ToString();
-            for (int I = 0; I < args.Length; I++)
-            {
-                final = final.Replace("{" + I + "}", args[I].ToString());
-            }
-            MonoBehaviour.print("[AutoStrut] " + final);
-        }
-
-        public override void OnLoad(ConfigNode node)
-        {
-            base.OnLoad(node);
-        }
-
-        public override void OnActive()
-        {
-            InitLaser();
-
-            base.OnActive();
-        }
-
-        public override void OnInactive()
-        {
-            DestroyLaser();
-
-            base.OnInactive();
-        }
-
-        public override string GetInfo()
-        {
-            return "Requires:\n- ElectricCharge (" + PowerConsumption + "/s.)\n\n Costs 5 to create strut.";
-            return base.GetInfo();
-        }
-
-        public override void OnStart(PartModule.StartState state)
-        {
-            try
-            {
-                print("Material: {0}", Material);
-                material = new Material(Shader.Find(Material.Trim()));
-            }
-            catch
-            {
-                material = null;
-            }
-
-            startColor = Vector3toColor(StartColor);
-            endColor = Vector3toColor(EndColor);
-
-            if (!Util.isValid(LaserMaterial))
-                LaserMaterial = new Material(Shader.Find("Particles/Additive"));
-
-            if (state == StartState.Docked)
-                CheckHit();
-
-            if (state == StartState.Editor)
-            {
-                Editor = true;
-                RenderingManager.AddToPostDrawQueue(0, DrawBuildOverlay);
-                InitLaser();
-            }
-            else
-            {
-                Editor = false;
-                RenderingManager.RemoveFromPostDrawQueue(0, DrawBuildOverlay);
-                DestroyLaser();
-            }
-
-            base.OnStart(state);
-        }
-
-        public override void OnFixedUpdate()
-        {
-            base.OnFixedUpdate();
-        }
-
-
-        public override void OnUpdate()
-        {
-            Events["ActivateStrut"].active = !IsEnabled;
-            Events["DeactivateStrut"].active = IsEnabled;
-
-            if (IsEnabled)
-            {
-                I = I + 1 % 255;
-
-                if (strut != null && !strut.isDestroyed)
-                {
-                    if (PowerConsumption == 0 || (Util.GetEnergy(part.vessel) > PowerConsumption * TimeWarp.fixedDeltaTime && part.RequestResource("ElectricCharge", PowerConsumption * TimeWarp.fixedDeltaTime) > 0))
-                        strut.Update();
-                    else
-                        strut.Destroy();
-                }
-                else
-                {
-                    if ((I % 10)==0)
-                    {
-                        CheckHit();
-                    }
-                }
-            }
-            else
-            {
-                if (strut != null)
-                {
-                    strut.Destroy();
-                    strut = null;
-                }
-            }
-
-            base.OnUpdate();
-        }
-
-        void CheckHit()
-        {
-            if (!isEnabled)
-            {
-                strut.Destroy();
-                strut = null;
-                return;
-            }
-
-            if (strut == null || strut.isDestroyed)
-            {
-                Vector3 dir = getTransform().TransformDirection(Dir);
-                Vector3 start = getTransform().TransformPoint(Start);
-
-                UnityEngine.RaycastHit info = new RaycastHit();
-                bool hit = Physics.Raycast(new UnityEngine.Ray(start + (dir * 0.05f), dir), out info, 10);
-                if (hit)
-                {
-                    Part targetPart = Util.partFromRaycast(info);
-
-                    if (targetPart && vessel.parts.Contains(targetPart) && Util.GetEnergy(part.vessel) > 5 * TimeWarp.fixedDeltaTime)
-                    {
-                        float energy = part.RequestResource("ElectricCharge", 5 * TimeWarp.fixedDeltaTime);
-
-                        strut = new Strut(part, targetPart, targetPart.transform.InverseTransformPoint(info.point), getTransform());
-                        strut.Material = material;
-                        strut.StartColor = startColor;
-                        strut.EndColor = endColor;
-                        strut.StartSize = StartSize;
-                        strut.EndSize = EndSize;
-                    }
-                }
-            }
-        }
-
-        void InitLaser()
-        {
-            if (!Util.isValid(lr))
-            {
-                lineObj = new GameObject();
-
-                lr = lineObj.AddComponent<LineRenderer>();
-                lr.useWorldSpace = true;
-
-                lr.material = material;
-                lr.SetColors(startColor, endColor);
-                lr.SetWidth(StartSize, EndSize);
-
-                lr.SetVertexCount(2);
-                lr.SetPosition(0, Vector3.zero);
-                lr.SetPosition(1, Vector3.zero);
-                lr.castShadows = false;
-                lr.receiveShadows = true;
-            }
-        }
-
-        void DestroyLaser()
-        {
-            if (Util.isValid(lr))
-                LineRenderer.DestroyImmediate(lr);
-
-            if (Util.isValid(lineObj))
-                GameObject.DestroyImmediate(lineObj);
-        }
-
-        public void DrawBuildOverlay()
-        {
-            if (Util.isValid(part))
-            {
-                if (!Editor) return;
-
-                if (Util.isValid(lr))
-                {
-                    Vector3 dir = getTransform().TransformDirection(Dir);
-                    Vector3 start = getTransform().TransformPoint(Start);
-
-                    UnityEngine.RaycastHit info = new RaycastHit();
-                    bool hit = Physics.Raycast(new UnityEngine.Ray(start + (dir * 0.05f), dir), out info, 10);
-                    if (hit)
-                    {
-                        if (Util.isValid(material))
-                            lr.material = material;
-
-                        lr.SetColors(startColor, endColor);
-                        lr.SetWidth(StartSize, EndSize);
-
-                        lr.SetPosition(0, start);
-                        lr.SetPosition(1, info.point);
-                    }
-                    else
-                    {
-                        lr.material = LaserMaterial;
-                        lr.SetColors(Color.red, Color.red);
-                        lr.SetWidth(0.01f, 0.01f);
-
-                        lr.SetPosition(0, start);
-                        lr.SetPosition(1, start + (dir * 10));
-                    }
-                }
-            }
-            else
-            {
-                DestroyLaser();
-                RenderingManager.RemoveFromPostDrawQueue(0, DrawBuildOverlay);
-            }
-        }
-    }
+	public class QuantumStrut : PartModule
+	{
+		public static Material LaserMaterial;
+		Strut strut = null;
+		GameObject lineObj;
+		LineRenderer lr;
+		bool Editor = false;
+		int I = 0;
+
+		#region Fields
+
+		[KSPField(isPersistant = true)]
+		public bool IsEnabled = true;
+		[KSPField(isPersistant = false)]
+		public float PowerConsumption = 0;
+		[KSPField(isPersistant = false)]
+		public string TransformName = "";
+		[KSPField(isPersistant = false)]
+		public Vector3 Start = new Vector3(0, 0, 0);
+		[KSPField(isPersistant = false)]
+		public Vector3 Dir = new Vector3(0, 1, 0);
+		[KSPField(isPersistant = false)]
+		public string Material = "Particles/Additive";
+		[KSPField(isPersistant = false)]
+		public Vector3 StartColor = Vector3.zero;
+		[KSPField(isPersistant = false)]
+		public Vector3 EndColor = Vector3.zero;
+		[KSPField(isPersistant = false)]
+		public float StartSize = 0.03f;
+		[KSPField(isPersistant = false)]
+		public float EndSize = 0.0075f;
+
+		#endregion
+
+		#region Actions
+
+		[KSPAction("Toggle")]
+		public void ToggleStrut(KSPActionParam param)
+		{
+			IsEnabled = !IsEnabled;
+			CheckHit();
+		}
+
+		[KSPAction("Activate")]
+		public void ActivateStrut(KSPActionParam param)
+		{
+			IsEnabled = true;
+			CheckHit();
+		}
+
+		[KSPAction("Deactivate")]
+		public void DeactivateStrut(KSPActionParam param)
+		{
+			IsEnabled = false;
+			CheckHit();
+		}
+
+		#endregion
+
+		#region Events
+
+		[KSPEvent(guiActive = true, guiName = "Activate", active = true)]
+		public void ActivateStrut()
+		{
+			IsEnabled = true;
+			CheckHit();
+		}
+
+		[KSPEvent(guiActive = true, guiName = "Deactivate", active = false)]
+		public void DeactivateStrut()
+		{
+			IsEnabled = false;
+			CheckHit();
+		}
+
+		#endregion
+
+		public Material material = null;
+		public Color startColor = Color.white;
+		public Color endColor = Color.white;
+
+		public Color Vector3toColor(Vector3 vec)
+		{
+			return new Color(vec.x / 255, vec.y / 255, vec.z / 255);
+		}
+
+		Transform getTransform()
+		{
+			if (TransformName == "")
+				return part.transform;
+			else
+				return part.FindModelTransform(TransformName);
+		}
+
+		public void print(object body, params object[] args)
+		{
+			string final = body.ToString();
+			for (int I = 0; I < args.Length; I++)
+			{
+				final = final.Replace("{" + I + "}", args[I].ToString());
+			}
+			MonoBehaviour.print("[AutoStrut] " + final);
+		}
+
+		public override void OnLoad(ConfigNode node)
+		{
+			base.OnLoad(node);
+		}
+
+		public override void OnActive()
+		{
+			InitLaser();
+
+			base.OnActive();
+		}
+
+		public override void OnInactive()
+		{
+			DestroyLaser();
+
+			base.OnInactive();
+		}
+
+		public override string GetInfo()
+		{
+			return "Requires:\n- ElectricCharge (" + PowerConsumption + "/s.)\n\n Costs 5 to create strut.";
+		}
+
+		public override void OnStart(PartModule.StartState state)
+		{
+			try
+			{
+				print("Material: {0}", Material);
+				material = new Material(Shader.Find(Material.Trim()));
+			}
+			catch
+			{
+				material = null;
+			}
+
+			startColor = Vector3toColor(StartColor);
+			endColor = Vector3toColor(EndColor);
+
+			if (!Util.isValid(LaserMaterial))
+				LaserMaterial = new Material(Shader.Find("Particles/Additive"));
+
+			if (state == StartState.Docked)
+				CheckHit();
+
+			if (state == StartState.Editor)
+			{
+				Editor = true;
+				RenderingManager.AddToPostDrawQueue(0, DrawBuildOverlay);
+				InitLaser();
+			}
+			else
+			{
+				Editor = false;
+				RenderingManager.RemoveFromPostDrawQueue(0, DrawBuildOverlay);
+				DestroyLaser();
+			}
+
+			base.OnStart(state);
+		}
+
+		public override void OnFixedUpdate()
+		{
+			base.OnFixedUpdate();
+		}
+
+		public override void OnUpdate()
+		{
+			Events["ActivateStrut"].active = !IsEnabled;
+			Events["DeactivateStrut"].active = IsEnabled;
+
+			if (IsEnabled)
+			{
+				I = I + 1 % 255;
+
+				if (strut != null && !strut.isDestroyed)
+				{
+					if (PowerConsumption == 0 || (Util.GetEnergy(part.vessel) > PowerConsumption * TimeWarp.fixedDeltaTime && part.RequestResource(
+						                   "ElectricCharge",
+						                   PowerConsumption * TimeWarp.fixedDeltaTime
+					                   ) > 0))
+						strut.Update();
+					else
+						strut.Destroy();
+				}
+				else
+				{
+					if ((I % 10) == 0)
+					{
+						CheckHit();
+					}
+				}
+			}
+			else
+			{
+				if (strut != null)
+				{
+					strut.Destroy();
+					strut = null;
+				}
+			}
+
+			base.OnUpdate();
+		}
+
+		void CheckHit()
+		{
+			if (!isEnabled)
+			{
+				strut.Destroy();
+				strut = null;
+				return;
+			}
+
+			if (strut == null || strut.isDestroyed)
+			{
+				Vector3 dir = getTransform().TransformDirection(Dir);
+				Vector3 start = getTransform().TransformPoint(Start);
+
+				UnityEngine.RaycastHit info = new RaycastHit();
+				bool hit = Physics.Raycast(new UnityEngine.Ray(start + (dir * 0.05f), dir), out info, 10);
+				if (hit)
+				{
+					Part targetPart = Util.partFromRaycast(info);
+
+					if (targetPart && vessel.parts.Contains(targetPart) && Util.GetEnergy(part.vessel) > 5 * TimeWarp.fixedDeltaTime)
+					{
+						strut = new Strut(
+							part,
+							targetPart,
+							targetPart.transform.InverseTransformPoint(info.point),
+							getTransform()
+						);
+						strut.Material = material;
+						strut.StartColor = startColor;
+						strut.EndColor = endColor;
+						strut.StartSize = StartSize;
+						strut.EndSize = EndSize;
+					}
+				}
+			}
+		}
+
+		void InitLaser()
+		{
+			if (!Util.isValid(lr))
+			{
+				lineObj = new GameObject();
+
+				lr = lineObj.AddComponent<LineRenderer>();
+				lr.useWorldSpace = true;
+
+				lr.material = material;
+				lr.SetColors(startColor, endColor);
+				lr.SetWidth(StartSize, EndSize);
+
+				lr.SetVertexCount(2);
+				lr.SetPosition(0, Vector3.zero);
+				lr.SetPosition(1, Vector3.zero);
+				lr.castShadows = false;
+				lr.receiveShadows = true;
+			}
+		}
+
+		void DestroyLaser()
+		{
+			if (Util.isValid(lr))
+				LineRenderer.DestroyImmediate(lr);
+
+			if (Util.isValid(lineObj))
+				GameObject.DestroyImmediate(lineObj);
+		}
+
+		public void DrawBuildOverlay()
+		{
+			if (Util.isValid(part))
+			{
+				if (!Editor)
+					return;
+
+				if (Util.isValid(lr))
+				{
+					Vector3 dir = getTransform().TransformDirection(Dir);
+					Vector3 start = getTransform().TransformPoint(Start);
+
+					UnityEngine.RaycastHit info = new RaycastHit();
+					bool hit = Physics.Raycast(new UnityEngine.Ray(start + (dir * 0.05f), dir), out info, 10);
+					if (hit)
+					{
+						if (Util.isValid(material))
+							lr.material = material;
+
+						lr.SetColors(startColor, endColor);
+						lr.SetWidth(StartSize, EndSize);
+
+						lr.SetPosition(0, start);
+						lr.SetPosition(1, info.point);
+					}
+					else
+					{
+						lr.material = LaserMaterial;
+						lr.SetColors(Color.red, Color.red);
+						lr.SetWidth(0.01f, 0.01f);
+
+						lr.SetPosition(0, start);
+						lr.SetPosition(1, start + (dir * 10));
+					}
+				}
+			}
+			else
+			{
+				DestroyLaser();
+				RenderingManager.RemoveFromPostDrawQueue(0, DrawBuildOverlay);
+			}
+		}
+	}
 }

--- a/QuantumStrutCore.cs
+++ b/QuantumStrutCore.cs
@@ -226,7 +226,6 @@
         public override string GetInfo()
         {
             return "Max Struts: " + MaxStruts + "\nRequires:\n- ElectricCharge (" + PowerConsumption + "/s.)\n\n Energy cost is per-strut.";
-            return base.GetInfo();
         }
 
         public override void OnStart(PartModule.StartState state)
@@ -301,7 +300,6 @@
             return str;
         }
 
-        bool kerbalPrinted = false;
         public override void OnUpdate()
         {
             bool eva = isValid(Util.Kerbal);

file:a/Strut.cs -> file:b/Strut.cs
--- a/Strut.cs
+++ b/Strut.cs
@@ -9,196 +9,204 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+
 //using System.Threading.Tasks;
 using UnityEngine;
 
 namespace QuantumStrut
 {
-    class Strut
-    {
-        public bool isDestroyed = false;
-
-        Material _material = null;
-        public Material Material
-        {
-            set
-            {
-                _material = value;
-                if(Material!=null)
-                    lr.material = Material;
-            }
-            get
-            {
-                return _material;
-            }
-        }
-
-        Color _startColor = Color.white;
-        public Color StartColor
-        {
-            set
-            {
-                _startColor = value;
-                if (StartColor != null && EndColor != null)
-                    lr.SetColors(StartColor, EndColor);
-            }
-            get
-            {
-                return _startColor;
-            }
-        }
-
-        Color _endColor = Color.white;
-        public Color EndColor
-        {
-            set
-            {
-                _endColor = value;
-                if (StartColor != null && EndColor != null)
-                    lr.SetColors(StartColor, EndColor);
-            }
-            get
-            {
-                return _endColor;
-            }
-        }
-
-        float _startSize = 0;
-        public float StartSize
-        {
-            set
-            {
-                _startSize = value;
-                lr.SetWidth(StartSize, EndSize);
-            }
-            get
-            {
-                return _startSize;
-            }
-        }
-
-        float _endSize = 0;
-        public float EndSize
-        {
-            set
-            {
-                _endSize = value;
-                lr.SetWidth(StartSize, EndSize);
-            }
-            get
-            {
-                return _endSize;
-            }
-        }
-
-        ConfigurableJoint joint;
-
-        Transform parentTransform = null;
-        Part parent = null;
-        Part target = null;
-        Vector3 targetOffset = Vector3.zero;
-
-        GameObject LineObj = null;
-        LineRenderer lr = null;
-
-        public void print(object body, params object[] args)
-        {
-            string final = body.ToString();
-            for (int I = 0; I < args.Length; I++)
-            {
-                final = final.Replace("{" + I + "}", args[I].ToString());
-            }
-            MonoBehaviour.print("[AutoStrut] " + final);
-        }
-
-        void DrawLine(Vector3 origin, Vector3 end)
-        {
-            if (Util.isValid(lr))
-            {
-                lr.SetPosition(0, origin);
-                lr.SetPosition(1, end);
-            }
-        }
-
-        public Strut(Part parent, Part target, Vector3 targetOffset, Transform parentTransform)
-        {
-            this.parent = parent;
-            this.target = target;
-            this.targetOffset = targetOffset;
-            this.parentTransform = parentTransform;
-
-            if (parent.vessel.parts.Contains(target))
-            {
-                joint = parent.parent.gameObject.AddComponent<ConfigurableJoint>();
-                joint.connectedBody = target.rigidbody;
-
-                joint.anchor = new Vector3(0, 0, Vector3.Distance(parentTransform.position, target.transform.TransformPoint(targetOffset)) / 2);
-                joint.axis = new Vector3(0, 0, 1);
-                joint.xMotion = ConfigurableJointMotion.Locked;
-                joint.yMotion = ConfigurableJointMotion.Locked;
-                joint.zMotion = ConfigurableJointMotion.Locked;
-                joint.angularXMotion = ConfigurableJointMotion.Locked;
-                joint.angularYMotion = ConfigurableJointMotion.Locked;
-                joint.angularZMotion = ConfigurableJointMotion.Locked;
-
-                LineObj = new GameObject();
-                LineObj.name = "quantumstrut";
-
-                lr = LineObj.AddComponent<LineRenderer>();
-                lr.useWorldSpace = true;
-
-                Material = QuantumStrut.LaserMaterial;
-                StartColor = Color.white;
-                EndColor = Color.white;
-                StartSize = 0.03f;
-                EndSize = 0.0075f;
-
-                lr.SetVertexCount(2);
-                lr.SetPosition(0, Vector3.zero);
-                lr.SetPosition(1, Vector3.zero);
-            }
-            else
-            {
-                Destroy();
-            }
-        }
-
-        public void Update()
-        {
-            if (Util.isValid(parent) && Util.isValid(target) && Util.isValid(parent.vessel) && parent.vessel.parts.Contains(target))
-            {
-                Vector3 start = parentTransform.position;
-                Vector3 end = target.transform.TransformPoint(targetOffset);
-                DrawLine(start, end);
-            }
-            else
-            {
-                DrawLine(Vector3.zero, Vector3.zero);
-                Destroy();
-            }
-        }
-
-        public void Destroy()
-        {
-            DrawLine(Vector3.zero, Vector3.zero);
-            if (Util.isValid(joint))
-                GameObject.DestroyImmediate(joint);
-
-            if (Util.isValid(lr))
-                GameObject.DestroyImmediate(lr);
-
-            if (Util.isValid(LineObj))
-                GameObject.DestroyImmediate(LineObj);
-
-            joint = null;
-            LineObj = null;
-            lr = null;
-
-            parentTransform = null;
-            parent = null;
-            target = null;
-            targetOffset = Vector3.zero;
-            isDestroyed = true;
-        }
-    }
+	class Strut
+	{
+		public bool isDestroyed = false;
+		Material _material = null;
+
+		public Material Material
+		{
+			set
+			{
+				_material = value;
+				if (Material != null)
+					lr.material = Material;
+			}
+			get
+			{
+				return _material;
+			}
+		}
+
+		Color _startColor = Color.white;
+
+		public Color StartColor
+		{
+			set
+			{
+				_startColor = value;
+				lr.SetColors(StartColor, EndColor);
+			}
+			get
+			{
+				return _startColor;
+			}
+		}
+
+		Color _endColor = Color.white;
+
+		public Color EndColor
+		{
+			set
+			{
+				_endColor = value;
+				lr.SetColors(StartColor, EndColor);
+			}
+			get
+			{
+				return _endColor;
+			}
+		}
+
+		float _startSize = 0;
+
+		public float StartSize
+		{
+			set
+			{
+				_startSize = value;
+				lr.SetWidth(StartSize, EndSize);
+			}
+			get
+			{
+				return _startSize;
+			}
+		}
+
+		float _endSize = 0;
+
+		public float EndSize
+		{
+			set
+			{
+				_endSize = value;
+				lr.SetWidth(StartSize, EndSize);
+			}
+			get
+			{
+				return _endSize;
+			}
+		}
+
+		ConfigurableJoint joint;
+		Transform parentTransform = null;
+		Part parent = null;
+		Part target = null;
+		Vector3 targetOffset = Vector3.zero;
+		GameObject LineObj = null;
+		LineRenderer lr = null;
+
+		public void print(object body, params object[] args)
+		{
+			string final = body.ToString();
+			for (int I = 0; I < args.Length; I++)
+			{
+				final = final.Replace("{" + I + "}", args[I].ToString());
+			}
+			MonoBehaviour.print("[AutoStrut] " + final);
+		}
+
+		void DrawLine(Vector3 origin, Vector3 end)
+		{
+			if (Util.isValid(lr))
+			{
+				lr.SetPosition(0, origin);
+				lr.SetPosition(1, end);
+			}
+		}
+
+		public Strut(Part parent, Part target, Vector3 targetOffset, Transform parentTransform)
+		{
+			this.parent = parent;
+			this.target = target;
+			this.targetOffset = targetOffset;
+			this.parentTransform = parentTransform;
+
+			if (parent.vessel.parts.Contains(target))
+			{
+				joint = parent.parent.gameObject.AddComponent<ConfigurableJoint>();
+				joint.connectedBody = target.rigidbody;
+
+				joint.anchor = new Vector3(
+					0,
+					0,
+					Vector3.Distance(
+						parentTransform.position,
+						target.transform.TransformPoint(targetOffset)
+					) / 2
+				);
+				joint.axis = new Vector3(0, 0, 1);
+				joint.xMotion = ConfigurableJointMotion.Locked;
+				joint.yMotion = ConfigurableJointMotion.Locked;
+				joint.zMotion = ConfigurableJointMotion.Locked;
+				joint.angularXMotion = ConfigurableJointMotion.Locked;
+				joint.angularYMotion = ConfigurableJointMotion.Locked;
+				joint.angularZMotion = ConfigurableJointMotion.Locked;
+
+				LineObj = new GameObject();
+				LineObj.name = "quantumstrut";
+
+				lr = LineObj.AddComponent<LineRenderer>();
+				lr.useWorldSpace = true;
+
+				Material = QuantumStrut.LaserMaterial;
+				StartColor = Color.white;
+				EndColor = Color.white;
+				StartSize = 0.03f;
+				EndSize = 0.0075f;
+
+				lr.SetVertexCount(2);
+				lr.SetPosition(0, Vector3.zero);
+				lr.SetPosition(1, Vector3.zero);
+			}
+			else
+			{
+				Destroy();
+			}
+		}
+
+		public void Update()
+		{
+			if (Util.isValid(parent) && Util.isValid(target) && Util.isValid(parent.vessel) && parent.vessel.parts.Contains(target))
+			{
+				Vector3 start = parentTransform.position;
+				Vector3 end = target.transform.TransformPoint(targetOffset);
+				DrawLine(start, end);
+			}
+			else
+			{
+				DrawLine(Vector3.zero, Vector3.zero);
+				Destroy();
+			}
+		}
+
+		public void Destroy()
+		{
+			DrawLine(Vector3.zero, Vector3.zero);
+			if (Util.isValid(joint))
+				GameObject.DestroyImmediate(joint);
+
+			if (Util.isValid(lr))
+				GameObject.DestroyImmediate(lr);
+
+			if (Util.isValid(LineObj))
+				GameObject.DestroyImmediate(LineObj);
+
+			joint = null;
+			LineObj = null;
+			lr = null;
+
+			parentTransform = null;
+			parent = null;
+			target = null;
+			targetOffset = Vector3.zero;
+			isDestroyed = true;
+		}
+	}
 }