refacctored, added countly and updated docs