finished off code