Refactor empty form check