created condition in main handler for page load