first part of implementation