integrate all code together