refactored stable 1