moved initialization of fields to constructor
made arguments final
replaced exception classes and added logging