added function to prevent multiple check statements