Initial code cloned from official qnapi repo: http://sourceforge.net/p/qnapi/code/HEAD/tree/trunk/