added some code so that custome fields can be used