general stuff

From pr #298

Thanks @MissAllSunday for the code. :)