Functions to get id