Code fixes per @metadave's review