Completed all necessary functions