nest if statements properly
remove superflous closing tag
indenting and spaces fixes