reformat main.xml
prepare db access