Code cleanup after reading @jasonsanjose's helpful suggestions