First somewhat functional version