fixed regex, added main(), added arguments and default values to several functions