Refactor the use of init and implement deinit where needed
Refactor the use of init and implement deinit where needed