MOAR refactoring :D

removed a foreach for optimization