working baseline code