working on even-odd algorithm