added the ability to set the lifetime of objects

Far from perfect but it is a proof of concept of something that might
work.