Fixed spacing and added check for when terms are empty