manually add a modified version of PR #8 by @isellsoap