cosmetics, adding comments to not trivial code, improving reference's resize