updated code but not finished yet