Added comments and imports
Added guts of the class from Ammars version. Needs updating for current environment
Added guts of class based on Ammars version, minus deprecated methods and with some small changes. Still needs updating and optimising