Added references.
Changed user preferences. 
Added main procedure.