restructured from penflip