refactored after review