unfinished middle code