Polished off the code -hazheng