Tuning the electronic structure of graphene through nitrogen doping: experiment and theory