added method to get nth element