working and catches exceptions