Code cleanup, move some parts to model
Merge pull request #39 from madevr/madevr

Code cleanup, move some parts to model
Merge pull request #40 from madevr/master

Code cleanup, move some parts to model