added pages events
some cleanup