Clean up logic a bit for #157