Added better escaping to SQL input strings