remove unneeded panics improve error handling add tests fix error checking that was comparing for exact values sort imports