Added IfMounted and fixed some critical bugs.