Use function to check for ready state
Use function to check for ready state