Condensed code to do the same stuff with less code