Wrote some functions. Not completely functional