updates #119 - better implementation