in addition using else if would help a lot here. (both in performance and readability