additional refactoring for logging and conditional expressions.