architecture overhaul and config change

switch from sourcing subfunctions to call them as scripts
and passing them arguments
config now stores stuff in files