did some light refactoring