Move the bulk of the raygun logic out of the bin and into the lib.