Added better error support