Correct issues pointed out in pull request comments

-  Surrounding variables in strings with ' '
- Adjustments to improve reliability
- Corrected various spelling or formatting errors