initial implementation of lab5-solution2