Update code. Please note that this code is quite old.