Optimizing expressions and program logic

Consider the following guidelines: