removed redundant curly braces
changed order according to speed