First reasonably functional version