inspired by libstrophe