refoactoring and new generic functions