fixed stupid error, replaced x with y
added y condition fn