updated codes ready for testing