added preferences, setting up application variables