Added ER diagram and fixed some of the code