Port updated code