Pretty much finished all functions