combined #25 and #29 and modified a bit to get it working for version 7.x-1.1