add function to drop privileges
move function to drop privileges to separate file and clean up included libraries
function to drop privileges