tidy function now uses regexp instead of replaceAll added to String class.