minor code update, using string.emty? instead of string.length == 0