Refactor

Simplified logic