Added option to expire objects and refactoring.

An option to expire objects has been added and some refactoring changes
have been made along the way.