fixed a few things and wrote the imprecord function. It's quite simple, but I feel it is necessary for testing, at least.