updated to rid of log and check empty