Improved locating of files directory, use $HOME instead of ~