Added root checking.

It is still work in progress. Root checking is so that there are no permission denied errors.