First version of working annotation algorithm