reorganizatio of code for clarity and beginning of better test scripts