finally reached a solution