non-recrusive version