removed setTimeout and better regexp