worked on functions, but not sure how to best implement