Improved completion, reference resolving and definition extraction. General code reformatting.