Merged @ruezel's latest changes with thulya's forked branch.