added relationships and some javascript