Added check for elements existence
Clean up