Some work before my pc died...
Adding some checks