Broke up functions into smaller pieces