Moved rawCapt source into a more library-like format.