implemented preferences.txt getting. Cleane up code and made html nicer (worse)