Changed algo to the old a$ pattern for older versions of php - don't use this in production\!