Credit to Fireblood2 for the idea and majority of the code, this is just fixing the little problem with the beam.