refactored the definition a bit, more testing