get inequality direction right. code still not working well though