lots of changes for auto-resolvation, seems to be working