Fixed some functions
Only two tests failing. sigh