small refactoring done, add special case for push document handling