Added input columns and fixed error checking