added some refactoring while i consider altering logic