Updated code to phase 8