rewrote to match misread requirements