More cleanup and better regex