FIX: replaced str_replace with preg_replace for whitespace removal