fix redundant code, add makefile and example webpage