code performance is improved (not finished)