align code better, add more comments