refactor, use settings api & other minor changes

not sure if you still maintain this, but here are some changes if you want 'em