logic was backwards