Major logic fix