Applying fixes from viorela's review