Source code reformatted and few bugs fixed.