update code in testing, still pending to fix bugs