Condensed code a bit