Added priv lib and runas lib

Cleaned up code with using the new lib files