Condensed Lexi's code.