added some more comments and if statements in preparation for different view sub-functions