basic code completed Oct 25