Fixing up logic