minor changes in expressions for reducing number of operations