fixed up new code