moved the functions, looks better now