tested code, runs well.