Combined functions into one