added AD lookup pieces, improved CSV parsing