added @SuppressWarnings("unchecked") for unchecked cast to prevent compiler warnings