used strcmp instead of complex comparison, code formatting