TODO cleanup needed in logic