Add life counter and fix lint errors