Started work on #14; fixed #22