merged in some changes from the mikeveen manually