reimplemented regex and began parsing logic