added functions, almost finished all