Add stats code; update build process