Changed multiple check functions to a sinle switched function