Added logic to get home directory.