Forked from Martin Lottering project (visible on codeproject.com)