functionsn cleaned up