lots of changes, added analytics