rework on Tazim's PRs: refactoring method calls, making the type as parameter to the calls.