Add some error checking n stuff