refactored graham, fixing s1