final implementation