lab8 implementation