Worked in proposed changes by Lorenz

Making the code a bit more readable and easier to maintain