refactored slightly
slightly refactored