Fixed some code smells