Added get_links funtion and solves some minor bugs