Combined Max and Christina's work. Regex slightly changed