fixed erros; improved controller; added exception class