Improvements to coding standard

1. condition needs to be enclosed with spaces inside control structures
Code updated to follow changed coding standards