Fixed some of the ugliness around path management. Hopefully didn't break anything :)