contoller now works with select loop