updated first draft of post tested code