Refactored form_is_ready function