fixed init command
refactored exceptions to use rest exception
formated code