Added original code from BSC