refactor code and build infrastructure