restructured code to allow for better logic flow
added 1.2.2 revision statement