Started gathering statistics and made some other improvements