added interleave checking, added lib to makefile