add depth init and switch func