functions now working