Added braces to if functions, braces were omitted

Added braces to if functions, braces were omitted. Added few whitespaces for readability.