update

clean up code
optimize performance