continues implementation. Todo: optimization