updated code. still need regex support