removed direct use of strsplit, and removed several explicit type conversions