Changed a little logic