Added level parsing and (poor) exception handling