type checking and printing modified and added