added better error handling. incremented version