added prefs, did some refactoring
Merge pull request #1 from akeaswaran/master

added prefs, did some refactoring