Based this on bitmapfun, adding ABS to support older platforms too.