cleanup/logic fixes