all in one function