Added global preferences and formatted source code