Started adding certificated checking, not complete