re-implemented changes in clean code