pulled some stuff together, many bugs
merged