implement most of specification