Defined various functions