Added checks for empty data.
Added checks for empty data. Use activate instead of enter.