Version 0.5

Fixed a few bugs and added pre-finalize callback functionalities.