added functionality for stage 4