removed some ugly code