version with contracts, minor design changes,  base for autorization