Added function return type checking