Cleaned up regex parsing