refactored.  related to #4