Changes from CoolDevelopement's MoshKernel for BLN