Added type checking and fixed major signature bug