refactored, test looks more like it should, abstracted from SDL