Corrected some small problems and studied code