updated doc & slight change to prevent unnecessary function call