further work on logic