commenting for example and slight code refactor