[UPGRADE] Another approach
[FIX] Moved to block to avoid stack overflow issue