Condensed code to be more concise.