fixed code smells that Alex pointed out