not sure how to implement some parts but here it is