first draft; flash implementation only