Modified for use with SPADE's APK