one function to rule them all