reorganize functions to make it work