Initial SBR code, based of Jason Dorweller's project.