Shrink it into one function