added regular expression restrictions and fixed some problems