made some things more easier to read
separated some functions

implemented new property for edit query so that we can prevent conflicts even
when new pages are being edited