the final answer. Fixed #3