Added Error checking