refactor portable mode & config file detection (WIP)

see #127
include--