First version -- all code