how to view was updated, also made function easier to read.