Working version of Code