Final version of solution

Added the db/counter solution with a transactional state system