Reducing number of functions