code refactor. Refs. 951