ugly function added