Created error checking