adapt it to be used in gui