added error handling and removed useless me variable