Made more generic and removed warning