refactored it slightly ;)