edited for coding standard compliance