Fix some code smells