uses throw instead of error, small fixes