updated to new code