Bad logic error on my part