Uses Regex#scan to remove a lot of code