Added Managment functionality and fixed a number of bugs