Added missing headers, removed unnecessary casts