Using isEmpty method instead of comparing to 0