Coming up with a logical and functional code 1