Improve code, remove not necessary lines and use if-else instead of return in the middles of some methods