ToDo: Refactor & test code