Minor code refactoring.
part of #68.