Updated code and added method to get links