Created by: varungandhi-src
Due to incorrect regex matching earlier, dashes didn't work in scope names. I've simplified other surrounding code as well.
Added unit tests.