Stage 2 code added