initial working code.