Probably better to use uint32_t than long here