cleaned up and upgrade