Redefined functions as global, put default partial render in if statement