Cleaner way of doing startup and cleanup hooks