updated to fully function