added misc.h, which contains various helping tools