[IMP] move code to generic module