work from ruby cookbook