#5 Refactor. Is not tested.