Completed Logic exercise