Updated from spec changes  V1.0.46

Changes initiated (Pieter A.M. Anemaet/Erix Techniek)
Also did some refactoring to attempt to make code more readable