revisit, clean up and added brief analysis