modified version of lab2 for ECE 499