Pulled some stuff out of lorina.js