Fixed projection code (repeated code removed)