Copied from https://github.com/zfigura/semblance