final version. non-cleared comments though