Added gym stop logic