Various changes

-todo: Review and test