added lock and mono/dec/inc detection
needs a bit fixing on the cases...