added code from openbook