added code to handle gender