Some logical ideas and fixes