added checks and stuff