Added changes from ElementalX

Added code from ElementalX