all functions now work properly