Found some functions that were accidently duplicated when moving code from HTML file to javascript file