added function to detect if input is empty