added preferences handling