Refactored formatting, removed redundant new lines

Refactored formatting, removed redundant new lines, added curly brackets