Reducing the amount of nested functions
Minor changes

Comment cleanup, separated out markAsRead into top level function, other
minor changes