Added code made by PanzerWolf