refactors into method and takes parameter