Replaced map lookup in init with custom binary search