adding recursion prevention