Added %g and %source, bugfixes