Adding drop_previleges + some minor changes