refactoring some code for code convention

change code block style {} to do-end