Reducing unnecessary function call